# Maintainer: Konstantin Podsvirov <konstantin@podsvirov.su>

_realname=quarter
pkgbase=mingw-w64-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-${_realname}")
pkgver=1.2.2
pkgrel=1
pkgdesc="Coin GUI binding for Qt (mingw-w64)"
arch=('any')
mingw_arch=('mingw64' 'ucrt64' 'clang64' 'clangarm64')
url='https://www.coin3d.org/Quarter/html/'
msys2_repository_url='https://github.com/coin3d/quarter'
license=('BSD')
makedepends=("${MINGW_PACKAGE_PREFIX}-cc"
             "${MINGW_PACKAGE_PREFIX}-cmake"
             "${MINGW_PACKAGE_PREFIX}-graphviz"
             "${MINGW_PACKAGE_PREFIX}-doxygen"
             "${MINGW_PACKAGE_PREFIX}-qt6-tools")
depends=("${MINGW_PACKAGE_PREFIX}-gcc-libs"
         "${MINGW_PACKAGE_PREFIX}-coin"
         "${MINGW_PACKAGE_PREFIX}-qt6-base")
optdepends=("${MINGW_PACKAGE_PREFIX}-qt6-tools: Designer plugin")
options=('!strip' '!buildflags')
source=("${msys2_repository_url}/archive/v${pkgver}/quarter-${pkgver}.tar.gz")
sha256sums=('4fcb85c0a9e7dfd32b8a86c6a6af0087f83eaf29e3f4e8528971e59ee75cf3d7')

build() {
  mkdir -p "${srcdir}/build-${MSYSTEM}" && cd "${srcdir}/build-${MSYSTEM}"

  MSYS2_ARG_CONV_EXCL="-DCMAKE_INSTALL_PREFIX=" \
  ${MINGW_PREFIX}/bin/cmake.exe \
    -G"MSYS Makefiles" \
    -DCMAKE_INSTALL_PREFIX=${MINGW_PREFIX} \
    -DCMAKE_BUILD_TYPE=Release \
    -DQUARTER_BUILD_PLUGIN=ON \
    -DQUARTER_BUILD_EXAMPLES=OFF \
    -DQUARTER_BUILD_DOCUMENTATION=ON \
    -DQUARTER_USE_CPPFLAGS=-DQUARTER_DLL \
    ../quarter-${pkgver}

  cmake --build .
}

package() {
  cd "${srcdir}/build-${MSYSTEM}"

  DESTDIR="${pkgdir}" cmake --install .

  install -Dm644 "${srcdir}/quarter-${pkgver}/COPYING" "${pkgdir}${MINGW_PREFIX}/share/licenses/${_realname}/LICENSE"
}

# vim:set ts=2 sw=2 et:
